UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SCihJ4I1jOnbzqkJCK3F3kx4nXv+aQT8+PPbi87vS1A='
WHERE
key_id = 'ab076eb20bac82c426bde174eb951197f85593f17fbfdbd5d46feb069837d242'
AND (
token = 'SCihJ4I1jOnbzqkJCK3F3kx4nXv+aQT8+PPbi87vS1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)