UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nRGqqrT3U4S+UEqf0FiWlYRT+7EFr+DjGp09pr2oZ8Q='
WHERE
key_id = 'd797be001a7548712d80cfe272bec148ea823cee32eafa20ebc9ad2f801071ac'
AND (
token = 'nRGqqrT3U4S+UEqf0FiWlYRT+7EFr+DjGp09pr2oZ8Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)