UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hT0m//X9Z1eG1FsjdgSfj8sBJT7UnB1F+baSGnDZ1kQ=' 
WHERE 
  key_id = '6a2ffbac02a4f112c3a1e84254da2aeea43e51b0746e94dfdd332a4e020db505' 
  AND (
    token = 'hT0m//X9Z1eG1FsjdgSfj8sBJT7UnB1F+baSGnDZ1kQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051