UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HILJqD7d6rxT+p4IycKDmQBLk1CY65ih538axirO7zA=' 
WHERE 
  key_id = 'bd2c84cfe27364adc6ec9154d0851df081e30bb97fa20df90ad394bf48d49051' 
  AND (
    token = 'HILJqD7d6rxT+p4IycKDmQBLk1CY65ih538axirO7zA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037