UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ChjPLwPBbF58yil0q0hsxe0aLsy9zSmepH6C4IpseWA=' 
WHERE 
  key_id = 'e4ec775b4c7cd840dcbd9f01f41ebca22e351855b4c049360fadf33a5d7b8783' 
  AND (
    token = 'ChjPLwPBbF58yil0q0hsxe0aLsy9zSmepH6C4IpseWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023