UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MPQXYRlQYJOGWPyDhDLxPlANdf4ZS09SM/UPZ7FKbNY=' 
WHERE 
  key_id = 'd1439e8c615a71322b85b1c9ca52a89399a46e9fa2f2d1e489fb2038b16841f5' 
  AND (
    token = 'MPQXYRlQYJOGWPyDhDLxPlANdf4ZS09SM/UPZ7FKbNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025