UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N4pGYrJvtTv6g4Ha+Vy7qUDqVEzbjCbgoWnjLRgFhms='
WHERE
key_id = 'f204665ac9cd1ce282fb561d35426bc2e4d49a2790ebe279d32b20bd1ffe35f6'
AND (
token = 'N4pGYrJvtTv6g4Ha+Vy7qUDqVEzbjCbgoWnjLRgFhms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)