UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWav38B7NgxDZAxoH0giKvs+EmFFhM37xx7BNgohND4=' 
WHERE 
  key_id = '6cce702f2b2cfe871b7abee976385b12f35b0493efb9ddd79fe257fb6a9b66d4' 
  AND (
    token = 'YWav38B7NgxDZAxoH0giKvs+EmFFhM37xx7BNgohND4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047