UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KQtZkUxIpyU5ssj+PexMkgTWk2tMyxb92DWowOVMvbk='
WHERE
key_id = '8c399993783144a3ee31f7a30b8deb6fadb88ec85dc4ada16246786b7baedd80'
AND (
token = 'KQtZkUxIpyU5ssj+PexMkgTWk2tMyxb92DWowOVMvbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)