UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'boHy41Ym00z1yV9XNEVJSEP/GUNirEsnh2W/phjmY6U='
WHERE
key_id = '97f3e946809bea1c9baa6b3a534c5501e0a71f05d402405467e4e83c19c9ba83'
AND (
token = 'boHy41Ym00z1yV9XNEVJSEP/GUNirEsnh2W/phjmY6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)