UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vZqSfhxBdIlwne7GaF5O87tbpmaZBjVqS6CNFCWXgJA='
WHERE
key_id = '1b8ef50baa67862df09f912d8408e16676b721a6246bd9820cbf5c80c6deac24'
AND (
token = 'vZqSfhxBdIlwne7GaF5O87tbpmaZBjVqS6CNFCWXgJA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)