UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '01I8sRmSnpxd8T5mCN0K85F55beGOPkEZDPZg9+lm3U='
WHERE
key_id = 'd821f51eff587e52bc6d9b4febf5c5f961cbd3fa83083a22738523a474e1c9b3'
AND (
token = '01I8sRmSnpxd8T5mCN0K85F55beGOPkEZDPZg9+lm3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)