UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JUjgwiRiy8ux4i8ZV7DzrENOJLZawNjQPANH81G6ISY=' 
WHERE 
  key_id = '1e600f3afa76f6ba09d4e1a27cefc0d513307fab0c65efd50a23a1709f223967' 
  AND (
    token = 'JUjgwiRiy8ux4i8ZV7DzrENOJLZawNjQPANH81G6ISY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022