UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '11Z0w7pQOPeVE1lkdeFxeyhYO273ZkWEro5c7m8i6KA='
WHERE
key_id = 'e6879ead679cda9db961df1d0305f453e840b73a218ef09fbc9deb46a5795a52'
AND (
token = '11Z0w7pQOPeVE1lkdeFxeyhYO273ZkWEro5c7m8i6KA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)