UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GmgwxeXjwKmrFDzW8pMxU47NMUIxTX7bqnWVvbIkfs8='
WHERE
key_id = '5440bb5ab733c2e184b583f01c4c843c73c620e3a2c29c7f3c403f50f84e4161'
AND (
token = 'GmgwxeXjwKmrFDzW8pMxU47NMUIxTX7bqnWVvbIkfs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)