UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bWym5h6dEX8vKY+zd3e+3g6h+/WbLJEXmpv0RxavsG4='
WHERE
key_id = '1de709fcdbdc57402fe1f263985aa9f3690e870652042618bd685e11abab3c13'
AND (
token = 'bWym5h6dEX8vKY+zd3e+3g6h+/WbLJEXmpv0RxavsG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)