UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wSirqbcf50AnrCYqWEvsRoK7BcaW8jghP7Lk1qcwxqw='
WHERE
key_id = 'd2c8e7262ab4aeb22e781c96be01c165e362220cc122a1c5659b6bd1277b465e'
AND (
token = 'wSirqbcf50AnrCYqWEvsRoK7BcaW8jghP7Lk1qcwxqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)