UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R467Rzf0xWFtwYSSUCM5X7VL75Ds9QMYG8bJi9PH5hY=' 
WHERE 
  key_id = '8ffd5f90c2b87c0029904aa54430ab702bf82f9ed370034e2eef97d6dff2c415' 
  AND (
    token = 'R467Rzf0xWFtwYSSUCM5X7VL75Ds9QMYG8bJi9PH5hY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055