UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lXuOVq5SF5jg2tLwTy+jSpFHYH6cvzRbD+8JTb+gZMU='
WHERE
key_id = 'cec06013ad243590af9f3a0da21a9e3a973010f0b1f004ead903384ce7ba8abc'
AND (
token = 'lXuOVq5SF5jg2tLwTy+jSpFHYH6cvzRbD+8JTb+gZMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)