UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nyzUNhBFcqGDKTDKLrjM5lM24tCXLkHy0NMvkf8Q4VE='
WHERE
key_id = '171f6b816c91b8f4bcef11e32d0103b189c827102b5651419c1cfc064336a8df'
AND (
token = 'nyzUNhBFcqGDKTDKLrjM5lM24tCXLkHy0NMvkf8Q4VE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)