UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kRQFCYM6rzZbxpRDhJXFnbF8mdV6ZUnsI6Ye66VmYc4='
WHERE
key_id = '66a2cb34051b4b0e13932d095165fcedccdeffe1670b2efb411994cc3e53309b'
AND (
token = 'kRQFCYM6rzZbxpRDhJXFnbF8mdV6ZUnsI6Ye66VmYc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)