UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SAo5E4pW+syY56qpY4uWQGkucpuCXeGHq/HMjxUTE0o=' 
WHERE 
  key_id = 'ea1a76048ace41b660b42cbd96c1d78536a113377ceb70839c469f4d75a33222' 
  AND (
    token = 'SAo5E4pW+syY56qpY4uWQGkucpuCXeGHq/HMjxUTE0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046