UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eGVRGVGzYG1B672ykdhN34LvkCT6VlJBP9jVosnn1uk=' 
WHERE 
  key_id = '67b66e7b32a1858dc8eafccf82244a1015166d9674a584970e7e995b5248f5fc' 
  AND (
    token = 'eGVRGVGzYG1B672ykdhN34LvkCT6VlJBP9jVosnn1uk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070