UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wM6Z4b7qDM1VmQSPW8cOuDSMm7PC7hJ/UtcsFDEt3rc=' 
WHERE 
  key_id = '90edd345f2d46d280999099930dc683a00ad24d62c866b656da277a305cdb0fc' 
  AND (
    token = 'wM6Z4b7qDM1VmQSPW8cOuDSMm7PC7hJ/UtcsFDEt3rc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047