UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm5ZqMOPFEgvgqRGnzsKAamI1cqPgdzdwu1jSRuHvqXY='
WHERE
key_id = '6d1c1987cb99dd38d56db9b69c3b798cb8c9e8eaa01844cc7624f1d95fa3698e'
AND (
token = 'm5ZqMOPFEgvgqRGnzsKAamI1cqPgdzdwu1jSRuHvqXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)