UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fTSixBWcDAPr3+8/HeZky1rwwy42p/hy+Xw51LcbZmI=' 
WHERE 
  key_id = '3c088756c9b0123035dcea159ef06b92246867a4c910499ad763f4af2bfb55c8' 
  AND (
    token = 'fTSixBWcDAPr3+8/HeZky1rwwy42p/hy+Xw51LcbZmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039