UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bhUqBNhrfLUcNMuTaiOofUaxY+l+lllZNsnzzWOrov8=' 
WHERE 
  key_id = '9a8cc83efcdf312390f7c9a4c23f99be2d28717766801bbf20a03cca778e01f6' 
  AND (
    token = 'bhUqBNhrfLUcNMuTaiOofUaxY+l+lllZNsnzzWOrov8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029