UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jNjav7vTwP0gw0KmEDU50wIGqWEEt3d6EZqXB/xLrrg='
WHERE
key_id = '30c3a532ee0f1480e6d40fe027a6369fca25230b61882c8b486780788e5a37c3'
AND (
token = 'jNjav7vTwP0gw0KmEDU50wIGqWEEt3d6EZqXB/xLrrg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)