UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'his8Z2pHXMmmYuOjW6xTJ6U08B2dj2ZuJL/klIMN1z4='
WHERE
key_id = '162ccfdd4c7c1296872aa210f0821060b43c96f66ecc8e4c74df287f2866b917'
AND (
token = 'his8Z2pHXMmmYuOjW6xTJ6U08B2dj2ZuJL/klIMN1z4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)