UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CsRgxZ3uRQvmonHtrM/2Aysy12HGpN0fZ02MxzHZkhA='
WHERE
key_id = 'cdd74debe198f1a98a1759214cb0fa326ddf338a5f396846dd95557257c81888'
AND (
token = 'CsRgxZ3uRQvmonHtrM/2Aysy12HGpN0fZ02MxzHZkhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)