UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8vKaCA95RotoqkHR31aLjev4MMUjTpCXKy2FRW6tycY='
WHERE
key_id = '87cac69fdba85e60053581c00160f29643479410f31315aa4531a80badbbaf1b'
AND (
token = '8vKaCA95RotoqkHR31aLjev4MMUjTpCXKy2FRW6tycY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)