UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N4S3AKcjzTi16aI4tTGqbKfbItX46no4H3Nnga7782E=' 
WHERE 
  key_id = '5863b4b7a8118dab465ba0426b1a44ce727b595e03e04ff1189ffcc8679ac4b7' 
  AND (
    token = 'N4S3AKcjzTi16aI4tTGqbKfbItX46no4H3Nnga7782E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029