UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CWxLXVG3V8erFPp3BlbXdx1KUXyvtoQvGL1+ZwtL3GE=' 
WHERE 
  key_id = '50730ab4343684fb4d31e8cb0de6b1189f3ee6fcde135cd5417c96c34b5e81b2' 
  AND (
    token = 'CWxLXVG3V8erFPp3BlbXdx1KUXyvtoQvGL1+ZwtL3GE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020