UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K9hLzJCHuttKfPiGm+1ZzlLtdOLPXsWanhZrGbHeX+U=' 
WHERE 
  key_id = '2116a19c818cdf09863b7de16366d190c5e2b04cc15728a23c8eae1c8e89dca8' 
  AND (
    token = 'K9hLzJCHuttKfPiGm+1ZzlLtdOLPXsWanhZrGbHeX+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061