UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sG3rUXgfKkEOtRG7WAIUFs0Zgql3bDajqZavhez8ok0='
WHERE
key_id = 'eb82d9ced5b4f839232e7f20edfc65814243b1f704a05851c07a9d77b1b2bf3f'
AND (
token = 'sG3rUXgfKkEOtRG7WAIUFs0Zgql3bDajqZavhez8ok0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)