UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZY844muFqoa+HU77OCnHYiUM+qoC57S/Fb4bFNeVnl4=' 
WHERE 
  key_id = '3b3bc2a6752410dca5b67d42792e1b285888cb8afdb6dc9d74c12fa496fbf9d5' 
  AND (
    token = 'ZY844muFqoa+HU77OCnHYiUM+qoC57S/Fb4bFNeVnl4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016