UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FlQ50HUTICT6ctON5wOosI9k0Jcv6hh0K0ttcxF+FYU='
WHERE
key_id = 'f052adf50f257f9ec94fbdc6b6fc2eff7473cbf465ceef1723293f9df1c821c9'
AND (
token = 'FlQ50HUTICT6ctON5wOosI9k0Jcv6hh0K0ttcxF+FYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)