UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rcr77RC6NzZENiq0KG224Z0A9wpGtEDsE98+j/NVCUw=' 
WHERE 
  key_id = '7b22df03db100852ce1238516a0dc9a6d7c677e0950ab14646cbeedb40afe539' 
  AND (
    token = 'Rcr77RC6NzZENiq0KG224Z0A9wpGtEDsE98+j/NVCUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032