UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WIU1QSJdNrhKX9F0prNHTSVoqLLqmSLLVN/Z8zPxaHM=' 
WHERE 
  key_id = '38663d5c05f1d70e2ab38211eeacca6a446b9e7aaa91b1f7abdcac407363e1db' 
  AND (
    token = 'WIU1QSJdNrhKX9F0prNHTSVoqLLqmSLLVN/Z8zPxaHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050