UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I4V8rn5nlucN5VyHLlSmSWf/PfT+iOpefUrTCvmAHUA=' 
WHERE 
  key_id = '3f26ccc92171f47e3c339c34e96c9e7100b62b01a1468de80cacaec02ca794d0' 
  AND (
    token = 'I4V8rn5nlucN5VyHLlSmSWf/PfT+iOpefUrTCvmAHUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035