UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tPG3gWKZf2vScgGSKDrDl/S02pW0Faz9U6Bnd1ZDPZc='
WHERE
key_id = 'ad51c3eb3b7e72e1e42b41d90c9a5d89afe8910a6a4cd157004805ae8b8d2828'
AND (
token = 'tPG3gWKZf2vScgGSKDrDl/S02pW0Faz9U6Bnd1ZDPZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)