UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BEUAfe9SPcJh5NBd07oqeJ5b9MLgr4rebq4e5gp6F0M='
WHERE
key_id = '547ab06bc259fd215d5503f59e42d3e61610c49721fe33650ceb6cbabf5f0d31'
AND (
token = 'BEUAfe9SPcJh5NBd07oqeJ5b9MLgr4rebq4e5gp6F0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)