UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bCYbspZbzkT5YVFHSgJRHqHK/RsaTC0gcYFOq/FInAY=' 
WHERE 
  key_id = '4c8338cf13bb0a724898843149719d6cb009cb641140fbd1de8806e0b3e66dd8' 
  AND (
    token = 'bCYbspZbzkT5YVFHSgJRHqHK/RsaTC0gcYFOq/FInAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028