UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZIqxE/vYe7OdFV8k04OdEl9bd8fKyyftuieYapnyJ1U='
WHERE
key_id = 'd79634b64541e33437942a3c3f9da03bfcbfd219f4b4254e9950b42d7dc58216'
AND (
token = 'ZIqxE/vYe7OdFV8k04OdEl9bd8fKyyftuieYapnyJ1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)