UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O1txb1GD3/rJ29BM+J4wjksaQvKccJ43LRaTw2d8SYs='
WHERE
key_id = '31db09410c0dd5b4edf5eae3aef4e5cb4f9281074b9ea2d71a3b2d948253697c'
AND (
token = 'O1txb1GD3/rJ29BM+J4wjksaQvKccJ43LRaTw2d8SYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)