UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vFllBsJxySL14DtPUHzzeh6pPDXEtdOqcP47pcnkUYw=' 
WHERE 
  key_id = 'a0912d342e331c4412de61cacf1e8296ec1ad3ff7721724d8c22a5b660dff666' 
  AND (
    token = 'vFllBsJxySL14DtPUHzzeh6pPDXEtdOqcP47pcnkUYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042