UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h1L/NA1rkdxUYiNsHHJ8idhOY8Hlpgg4xSr7eNeeogI=' 
WHERE 
  key_id = '3bc33f9a8078c88ab7b575558a4ee35f6daba13aefec628c9f1da34f12288b50' 
  AND (
    token = 'h1L/NA1rkdxUYiNsHHJ8idhOY8Hlpgg4xSr7eNeeogI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021