UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yF+xvTh0nqMB5dbppyPOB57PT4CCqE+AUnjjwkAGUKM=' 
WHERE 
  key_id = '3efe129473fc7966c4b53cf4a237e41628a81390dec06eea5caa8afa6bd3ba17' 
  AND (
    token = 'yF+xvTh0nqMB5dbppyPOB57PT4CCqE+AUnjjwkAGUKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029