UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PYRzciuzY+2Nw+gJF2zmMf/Cljg4I/B+wX1rX5zik4E='
WHERE
key_id = 'a32985416a275ee9e706c9a56814c1dee53da08a8a22902e7a494eebca654b3a'
AND (
token = 'PYRzciuzY+2Nw+gJF2zmMf/Cljg4I/B+wX1rX5zik4E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)