UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LXHD4TyCqXiW5iw2nurfPpP9Wp/FO6+M6AB8S+crMl4=' 
WHERE 
  key_id = '1926c5c37ec3266f3790c007c6c555c49b089b52054b012f6d81b0b037d4e26e' 
  AND (
    token = 'LXHD4TyCqXiW5iw2nurfPpP9Wp/FO6+M6AB8S+crMl4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023