UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mwkEJOJfCQHcTVa/xrOF9XVpAD5deXlcIYyqzho+6CM=' 
WHERE 
  key_id = '12e7f0dbff9fdb17651258cce8d8a1362931726d20a023ab869426b0408c1d13' 
  AND (
    token = 'mwkEJOJfCQHcTVa/xrOF9XVpAD5deXlcIYyqzho+6CM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036