UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ty+G4bBj8PdTbMNhOsGQNhlubA0RzhpyzN/4KGO3jxU=' 
WHERE 
  key_id = 'bc871fb2bcbb9b9f942a0c02d5d45d3739c468d472f826fc53c2ec08c4d2da6d' 
  AND (
    token = 'ty+G4bBj8PdTbMNhOsGQNhlubA0RzhpyzN/4KGO3jxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020