UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wFvnpXwN+L433JBTTINYjIzcnlKeu5yiglUkVcLuAqY=' 
WHERE 
  key_id = '89757c46f14c3786c9da488675fd4220a0e317a8ddffd9f597239d88e9bd334b' 
  AND (
    token = 'wFvnpXwN+L433JBTTINYjIzcnlKeu5yiglUkVcLuAqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031