UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QZl2rMUKHgP4FDo84efSn2eM6FfJt17YpEEOPvku+v4='
WHERE
key_id = 'a46cf9370253d8faf3327c28240109611931bceb0c9fd8b220e4a574f773d4ef'
AND (
token = 'QZl2rMUKHgP4FDo84efSn2eM6FfJt17YpEEOPvku+v4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)