UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tx/XgTzPNkfg+6KytCOd0xSS+R6IzW6R/wGrTmydSvQ=' 
WHERE 
  key_id = 'bba9b8f0241f732ab8b9763eb8d9540bc68b3366bd87dcd4da98d368ee6ad788' 
  AND (
    token = 'Tx/XgTzPNkfg+6KytCOd0xSS+R6IzW6R/wGrTmydSvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016