UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o6SNTFis+wvFeUU/+sUIl5TY2nalsJvnZEocO8CHkgA='
WHERE
key_id = '87e2aa0bc21c70d69b78fbee8732db7642221bcd64506c1fc21f107e743a02fb'
AND (
token = 'o6SNTFis+wvFeUU/+sUIl5TY2nalsJvnZEocO8CHkgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)