UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'koLwHCsqq+OxKQ2B6ggrp72odamTeSdyd2m8tY8Uos4='
WHERE
key_id = '84c5ac94439d8b3dbe3eb678e0e1d6195c2f8056d0fa8b42ba8e353bb332edb3'
AND (
token = 'koLwHCsqq+OxKQ2B6ggrp72odamTeSdyd2m8tY8Uos4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)