UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j5qHFEKNyH049Jmce3TxvBh7cfeDGD6vT52dpTnlAR0='
WHERE
key_id = '99686c66ea21b2bbcfdaf2eab8dda253f83bf14331758bb3f6e6a88c4f56736f'
AND (
token = 'j5qHFEKNyH049Jmce3TxvBh7cfeDGD6vT52dpTnlAR0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)