UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HSLOL+xT4JZ6QcyUhoYktt9PPyOukAdKifMVkdrz+KQ=' 
WHERE 
  key_id = '82f97a557421cc20c6015e197302c419d78fb9fdfb0fc6168e5ba092cd8c8257' 
  AND (
    token = 'HSLOL+xT4JZ6QcyUhoYktt9PPyOukAdKifMVkdrz+KQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032